package com.tiniplanet.webgate.service.impl;

import java.io.Serializable;
import java.util.List;
import java.util.Map;

import com.tiniplanet.webgate.dao.GenericDao;
import com.tiniplanet.webgate.service.GenericService;

public abstract class GenericServiceImpl<T, PK extends Serializable> implements GenericService<T, PK> {

	protected abstract GenericDao<T, PK> getBaseDao();
		
	@Override
	public List<T> getAll() {
		return getBaseDao().getAll();
	}

	@Override
	public List<T> getAllDistinct() {
		return getBaseDao().getAllDistinct();
	}

	@Override
	public T get(PK id) {
		return getBaseDao().get(id);
	}

	@Override
	public boolean exists(PK id) {
		return getBaseDao().exists(id);
	}

	@Override
	public T save(T object) {
		return getBaseDao().save(object);
	}

	@Override
	public void remove(PK id) {
		getBaseDao().remove(id);
	}

	@Override
	public List<T> findByNamedQuery(String queryName, Map<String, Object> queryParams) {
		return getBaseDao().findByNamedQuery(queryName, queryParams);
	}

}
